package com.unisv.dj;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.ImageView;

/**
 * <p>
 * init activity
 * </p>
 * 
 * @author fanzhen
 * @time 8:04:13 PM Sep 23, 2011
 * @email fanzhen.meng@gmail.com
 */
public class InitActivity extends Activity {
	private ImageView auto;
	private ImageView coach;
	private ImageView cycle;
	private ImageView heartrate;
	private ImageView manuan;
	private ImageView setting;
	private ImageView music;
	private ImageView video;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
				WindowManager.LayoutParams.FLAG_FULLSCREEN);
		setContentView(R.layout.init);
		auto = (ImageView) findViewById(R.id.auto);
		coach = (ImageView) findViewById(R.id.coach);
		cycle = (ImageView) findViewById(R.id.cycle);
		manuan = (ImageView) findViewById(R.id.manuan);
		heartrate = (ImageView) findViewById(R.id.heartrate);
		setting = (ImageView) findViewById(R.id.setting);
		music = (ImageView) findViewById(R.id.music);
		video = (ImageView) findViewById(R.id.video);
		auto.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(getApplication(), AutoActivity.class);
				startActivity(intent);
			}
		});
		coach.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(getApplication(),
						CoachActivity.class);
				startActivity(intent);
			}
		});
		cycle.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(getApplication(),
						CycleActivity.class);
				startActivity(intent);
			}
		});
		manuan.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(getApplication(),
						ManualActivity.class);
				startActivity(intent);
			}
		});
		heartrate.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(getApplication(),
						HeartRateActivity.class);
				startActivity(intent);
			}
		});
		setting.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
//				Intent intent = new Intent(getApplication(),
//						SettingActivity.class);
//				startActivity(intent);
			}
		});
		music.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent(MediaStore.INTENT_ACTION_MUSIC_PLAYER);
				startActivity(intent);
			}
		});
		video.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View arg0) {
				Intent intent = new Intent();  
				intent.setAction(android.content.Intent.ACTION_VIEW);
				intent.setDataAndType(Uri.EMPTY, "video/*");
				startActivity(intent);
			}
		});
	}

	@Override
	protected void onResume() {
		// TODO Auto-generated method stub
//		Command.initDj();
		super.onResume();
		Intent intent = new Intent(getApplication(),ServerService.class);
		startService(intent);
	}
}
